#pragma once


#include <vector>
#include <hash_map>
#include "Type.h"

using namespace stdext;
using namespace std;

class Follow {
	private:
		hash_map<Type::Index::Line,Type::Index::Line> followRelation;
		hash_map<Type::Index::Line,Type::Index::Line> revertFollowRelation;
		bool isPresent(vector<int>,int);
		vector<vector<bool>> followsBitMap;
		bool followsBitMapSetFlag;

	public:
		Follow(void);
		~Follow(void);

		///the second Type::Index::Stmt follows the first Type::Index::Stmt
		void setFollows(Type::Index::Line,Type::Index::Line);


		///get the Type::Index::Stmt which follows the given Type::Index::Stmt (If none is found return -1)
		Type::Index::Line getFollows(Type::Index::Line);  

		///get the Type::Index::Stmt which is followed by the given Type::Index::Stmt (If none is found return -1)
		Type::Index::Line getFollowedBy(Type::Index::Line);

		///return true if the second Type::Index::Stmt follows the first Type::Index::Stmt
		bool isFollows(Type::Index::Line,Type::Index::Line);

		//return true if the bitMap is set correctly
		bool setFollowsBitMap(vector<vector<bool>>);
		
		bool isBitMapSet();
};